<!DOCTYPE html>



  


<html class="theme-next pisces use-motion" lang="">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
















  
  
  <link href="/blog/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />







<link href="/blog/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/blog/css/main.css?v=5.1.4" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/blog/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/blog/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/blog/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/blog/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="Hexo, NexT" />










<meta name="description" content="分类:1）插入排序 (直接插入排序、希尔排序)2）交换排序 (冒泡排序、快速排序)3）选择排序 (直接选择排序、堆排序)4）归并排序5）分配排序 (基数排序)">
<meta name="keywords" content="Android、iOS、Web、React Native">
<meta property="og:type" content="article">
<meta property="og:title" content="Java-常用排序算法--8大排序算法">
<meta property="og:url" content="http://yoursite.com/blog/2018/08/06/Algorithm/Java-常用排序算法--8大排序算法/index.html">
<meta property="og:site_name" content="凌浩雨_博客">
<meta property="og:description" content="分类:1）插入排序 (直接插入排序、希尔排序)2）交换排序 (冒泡排序、快速排序)3）选择排序 (直接选择排序、堆排序)4）归并排序5）分配排序 (基数排序)">
<meta property="og:locale" content="default">
<meta property="og:image" content="http://upload-images.jianshu.io/upload_images/3110861-beda97957c0e54c4.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="http://upload-images.jianshu.io/upload_images/3110861-f338a5c150ddcfb8.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="http://upload-images.jianshu.io/upload_images/3110861-2e3f8bb2f7898fce.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="http://upload-images.jianshu.io/upload_images/3110861-ca19132a537a90fa.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="http://upload-images.jianshu.io/upload_images/3110861-6befe573200e1ecb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="http://upload-images.jianshu.io/upload_images/3110861-ddc6a97c1fd54f31.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="http://upload-images.jianshu.io/upload_images/3110861-b1a13384fcde1c63.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="http://upload-images.jianshu.io/upload_images/3110861-cde6636d4ac42f36.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="http://upload-images.jianshu.io/upload_images/3110861-ce4f481089bacba1.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:updated_time" content="2018-08-06T11:23:44.292Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Java-常用排序算法--8大排序算法">
<meta name="twitter:description" content="分类:1）插入排序 (直接插入排序、希尔排序)2）交换排序 (冒泡排序、快速排序)3）选择排序 (直接选择排序、堆排序)4）归并排序5）分配排序 (基数排序)">
<meta name="twitter:image" content="http://upload-images.jianshu.io/upload_images/3110861-beda97957c0e54c4.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/blog/',
    scheme: 'Pisces',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: 'Author'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://yoursite.com/blog/2018/08/06/Algorithm/Java-常用排序算法--8大排序算法/"/>





  <title>Java-常用排序算法--8大排序算法 | 凌浩雨_博客</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="default">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/blog/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">凌浩雨_博客</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/blog/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            Home
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/blog/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            Archives
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/blog/blog/2018/08/06/Algorithm/Java-常用排序算法--8大排序算法/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="凌浩雨">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/blog/images/avatar.jpeg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="凌浩雨_博客">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">Java-常用排序算法--8大排序算法</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">Posted on</span>
              
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2018-08-06T18:01:38+08:00">
                2018-08-06
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p><strong>分类:</strong><br>1）插入排序 (直接插入排序、希尔排序)<br>2）交换排序 (冒泡排序、快速排序)<br>3）选择排序 (直接选择排序、堆排序)<br>4）归并排序<br>5）分配排序 (基数排序)</p>
<a id="more"></a>
<p>所需辅助空间最多：归并排序;<br>所需辅助空间最少：堆排序;<br>平均速度最快：快速排序;<br>不稳定：快速排序，希尔排序，堆排序。 </p>
<p><img src="http://upload-images.jianshu.io/upload_images/3110861-beda97957c0e54c4.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="8大排序.png"></p>
<ol>
<li>直接插入排序<br><img src="http://upload-images.jianshu.io/upload_images/3110861-f338a5c150ddcfb8.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="直接插入排序.png"></li>
</ol>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br></pre></td><td class="code"><pre><span class="line">/**</span><br><span class="line"> * 直接插入排序</span><br><span class="line"> * 思想: 在要排序的一组数中，假设前面(n-1)[n&gt;=2]个数已经是排好顺序的,</span><br><span class="line"> * 现在要把第n个数插到前面的有序数中, 使得这n个数也是排好顺序的, 如此反</span><br><span class="line"> * 复循环,直到全部排好顺序。</span><br><span class="line"> */</span><br><span class="line">public static void insertSort() &#123;</span><br><span class="line">	// 排序数组</span><br><span class="line">	int[] array = &#123;49,38,65,97,76,13,27,49,78,34,12,64,5,4,62,</span><br><span class="line">			99,98,54,56,17,18,23,34,15,35,25,53,51&#125;;</span><br><span class="line">	// 临时量</span><br><span class="line">	int temp = 0;</span><br><span class="line">	// 从第2位开始循环, 第一位不用进入循环</span><br><span class="line">	for(int i = 1, size = array.length; i &lt; size; i++)&#123;</span><br><span class="line">		int j = i - 1;</span><br><span class="line">		// 将第i位的数据存储在临时变量中</span><br><span class="line">		temp = array[i];</span><br><span class="line">		// 从当前位置的前一位开始比较, 当第i位的数值大于第j位时, 跳出循环</span><br><span class="line">		for (; j &gt;= 0 &amp;&amp; temp &lt; array[j]; j--) &#123;</span><br><span class="line">			array[j+1] = array[j];// 将大于temp的值整体后移一个单位</span><br><span class="line">		&#125;</span><br><span class="line">		// 临时变量的值赋值给j+1位置</span><br><span class="line">		array[j+1] = temp;</span><br><span class="line">	&#125;</span><br><span class="line">	</span><br><span class="line">	for(int i = 0, size = array.length; i &lt; size; i++)&#123;</span><br><span class="line">		System.out.println(array[i]);</span><br><span class="line">	&#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<ol start="2">
<li>希尔排序（最小增量排序）<br><img src="http://upload-images.jianshu.io/upload_images/3110861-2e3f8bb2f7898fce.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="希尔排序.png"></li>
</ol>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br></pre></td><td class="code"><pre><span class="line">/**</span><br><span class="line"> * 希尔排序(最小增量排序) 思想: 算法先将要排序的一组数按某个增量d(n/2,n为要排序数的个数)分成若干组,</span><br><span class="line"> * 每组中记录的下标相差d对每组中全部元素进行直接插入排序,然后再用一个较小的增量 (d/2)对它进行分组,</span><br><span class="line"> * 在每组中再进行直接插入排序。当增量见到1时,进行直接插入 排序后,排序完成。</span><br><span class="line"> */</span><br><span class="line">public static void shellSort() &#123;</span><br><span class="line">	// 要排序的数组</span><br><span class="line">	int array[] = &#123; 1, 54, 6, 3, 78, 34, 12, 45, 56, 100 &#125;;</span><br><span class="line">	// 数组长度</span><br><span class="line">	double d1 = array.length;</span><br><span class="line">	// 临时变量</span><br><span class="line">	int temp = 0;</span><br><span class="line">	while (true) &#123;</span><br><span class="line">		// 获取增量--最小值</span><br><span class="line">		d1 = Math.ceil(d1 / 2);</span><br><span class="line">		// 获取增量整数部分</span><br><span class="line">		int d = (int) d1;</span><br><span class="line">		// 根据精度进行循环</span><br><span class="line">		for (int x = 0; x &lt; d; x++) &#123;</span><br><span class="line">			// 直接插入排序</span><br><span class="line">			for (int i = x + d; i &lt; array.length; i += d) &#123;</span><br><span class="line">				int j = i - d;</span><br><span class="line">				temp = array[i];</span><br><span class="line">				for (; j &gt;= 0 &amp;&amp; temp &lt; array[j]; j -= d) &#123;</span><br><span class="line">					array[j + d] = array[j];</span><br><span class="line">				&#125;</span><br><span class="line">				array[j + d] = temp;</span><br><span class="line">			&#125;</span><br><span class="line">		&#125;</span><br><span class="line">		// 当精度等于1的时候跳出循环</span><br><span class="line">		if (d == 1) &#123;</span><br><span class="line">			break;</span><br><span class="line">		&#125;</span><br><span class="line">	&#125;</span><br><span class="line">	// 打印数据</span><br><span class="line">	for(int i = 0, size = array.length; i &lt; size; i++)&#123;</span><br><span class="line">		System.out.println(array[i]);</span><br><span class="line">	&#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<ol start="3">
<li>简单选择排序<br><img src="http://upload-images.jianshu.io/upload_images/3110861-ca19132a537a90fa.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="简单选择排序.png"></li>
</ol>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br></pre></td><td class="code"><pre><span class="line">/**</span><br><span class="line"> * 简单选择排序</span><br><span class="line"> * 思想: 在要排序的一组数中, 选出最小的一个数与第一个位置的数交换,</span><br><span class="line"> * 然后在剩下的数当中再找最小的与第二个位置的数交换, 如此循环到倒数</span><br><span class="line"> * 第二个数和最后一个数比较为止。</span><br><span class="line"> */</span><br><span class="line">public static void selectSort() &#123;</span><br><span class="line">	// 要排序的数</span><br><span class="line">	int[] array = &#123;1,54,6,3,78,34,12,45&#125;;</span><br><span class="line">	// 当前位置</span><br><span class="line">	int position = 0;</span><br><span class="line">	// 循环排序</span><br><span class="line">	for(int i = 0, size = array.length; i &lt; size; i++)&#123;</span><br><span class="line">		// 获取当前位置的后一位数据</span><br><span class="line">		int j = i + 1;</span><br><span class="line">		position = i;</span><br><span class="line">		// 将当前位置的数存在临时变量中</span><br><span class="line">		int temp = array[i];</span><br><span class="line">		// 循环获取最小值</span><br><span class="line">		for(; j &lt; size; j++)&#123;</span><br><span class="line">			// 判断当前位置的数与临时变量中的数值大小</span><br><span class="line">			if (array[j] &lt; temp) &#123;</span><br><span class="line">				// 如果小于, 则将值赋予temp, 位置赋予position</span><br><span class="line">				temp = array[j];</span><br><span class="line">				position = j;</span><br><span class="line">			&#125;</span><br><span class="line">		&#125;</span><br><span class="line">		// 将最小值与第i的数据进行交换</span><br><span class="line">		array[position] = array[i];</span><br><span class="line">		array[i] = temp;</span><br><span class="line">	&#125;</span><br><span class="line">	// 打印数据</span><br><span class="line">	for(int i = 0, size = array.length; i &lt; size; i++)&#123;</span><br><span class="line">		System.out.println(array[i]);</span><br><span class="line">	&#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<ol start="4">
<li><p>堆排序<br><img src="http://upload-images.jianshu.io/upload_images/3110861-6befe573200e1ecb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="堆排序.png"></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br></pre></td><td class="code"><pre><span class="line">/**</span><br><span class="line"> * 堆排序</span><br><span class="line"> * 原理: 堆排序是一种树形选择排序, 是对直接选择排序的有效改进。</span><br><span class="line"> * 堆的定义如下: 具有n个元素的序列(h1,h2,...,hn), 当且仅当</span><br><span class="line"> * (hi&gt;=h2i,hi&gt;=2i+1)或(hi&lt;=h2i,hi&lt;=2i+1)(i=1,2,...,n/2)</span><br><span class="line"> * 时称之为堆. 在这里只讨论满足前者条件的堆。由堆的定义可以看出,</span><br><span class="line"> * 对顶元素(即第一个元素)比为最大项(大顶堆). 完全二叉树可以很直观</span><br><span class="line"> * 的表示堆结构. 堆顶为根, 其它为左子树、右子树.初始时把要排序的数</span><br><span class="line"> * 的序列看作是一棵顺序存储的二叉树,调整他们的存储序,使之成为一个堆,</span><br><span class="line"> * 这时堆的根节点的数最大.然后将根节点与堆的最后一个节点交换.然后对前</span><br><span class="line"> * 面(n-1)个数重新调整使之成为堆.以此类推，直到只有两个节点的堆,并对</span><br><span class="line"> * 它们作交换,最后得到有n个节点的有序序列.从算法描述来看,堆排序需要两个</span><br><span class="line"> * 过程,一个是建立堆,二是堆顶与堆的最后一个元素交换位置.所以堆排序有两</span><br><span class="line"> * 个函数组成.一是建堆的渗透函数,二是反复调用渗透函数实现排序的函数.</span><br><span class="line"> */</span><br><span class="line">public static void heapSort() &#123;</span><br><span class="line">	// 要排序的数组</span><br><span class="line">	int[] array=&#123;49,38,65,97,76,13,27,49,78,34,12,64,5,4,62,99,</span><br><span class="line">			98,54,56,17,18,23,34,15,35,25,53,51&#125;;   </span><br><span class="line">	System.out.println(&quot;开始排序&quot;);</span><br><span class="line">	// 获取数组长度</span><br><span class="line">	int  arrayLength = array.length;</span><br><span class="line">	// 循环建堆</span><br><span class="line">	for(int i = 0; i &lt; arrayLength - 1; i++)&#123;</span><br><span class="line">		// 建堆</span><br><span class="line">		buildMaxHeap(array, arrayLength - 1 - i);</span><br><span class="line">		// 交换堆顶和最后一个元素</span><br><span class="line">		swap(array, 0, arrayLength - 1 - i);</span><br><span class="line">		System.out.println(Arrays.toString(array));</span><br><span class="line">	&#125;		</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">/**</span><br><span class="line"> * 交换数据</span><br><span class="line"> * @param array 数组</span><br><span class="line"> * @param start 栈顶位置 </span><br><span class="line"> * @param end 最后一个元素</span><br><span class="line"> */</span><br><span class="line">private static void swap(int[] array, int start, int end) &#123;</span><br><span class="line">	int tmp = array[start];</span><br><span class="line">	array[start] = array[end];</span><br><span class="line">	array[end] = tmp;		</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">/**</span><br><span class="line"> * 对数组从0到lastIndex建立大顶推</span><br><span class="line"> * @param array 数组</span><br><span class="line"> * @param lastIndex 最后一个位置</span><br><span class="line"> */</span><br><span class="line">private static void buildMaxHeap(int[] array, int lastIndex) &#123;</span><br><span class="line">	// 从lastIndex处节点(最后一个节点)的父节点开始</span><br><span class="line">	for(int i = (lastIndex - 1) / 2; i &gt;= 0; i--)&#123;</span><br><span class="line">		// 保存正在判断的节点</span><br><span class="line">		int k = i;</span><br><span class="line">		// 如果当前k节点的子节点存在</span><br><span class="line">		while(k * 2 + 1 &lt;= lastIndex)&#123;</span><br><span class="line">			// k节点的左子节点的索引</span><br><span class="line">			int biggerIndex = 2 * k +1;</span><br><span class="line">			// 如果biggerIndex 小于 lastIndex, 即biggerIndex+1代表的k节点的右子节点存在</span><br><span class="line">			if (biggerIndex &lt; lastIndex) &#123;</span><br><span class="line">				// 如果右节点的值较大</span><br><span class="line">				if (array[biggerIndex] &lt; array[biggerIndex + 1]) &#123;</span><br><span class="line">					// biggerIndex总是记录较大子节点的索引</span><br><span class="line">					biggerIndex++;</span><br><span class="line">				&#125;</span><br><span class="line">			&#125;</span><br><span class="line">			// 如果k节点的值小于其较大的子节点的值</span><br><span class="line">			if (array[k] &lt; array[biggerIndex]) &#123;</span><br><span class="line">				// 交换他们</span><br><span class="line">				swap(array, k, biggerIndex);</span><br><span class="line">				// 将biggerIndex赋予k,开始while循环的下一次循环,重新保证k节点的值大于其左右有几点的值</span><br><span class="line">				k = biggerIndex;</span><br><span class="line">			&#125; else &#123;</span><br><span class="line">				break;</span><br><span class="line">			&#125;</span><br><span class="line">		&#125;</span><br><span class="line">	&#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
<li><p>冒泡排序<br><img src="http://upload-images.jianshu.io/upload_images/3110861-ddc6a97c1fd54f31.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="冒泡排序.png"></p>
</li>
</ol>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><span class="line">/**</span><br><span class="line"> * 冒泡排序</span><br><span class="line"> * 思想: 在要排序的一组数中, 对当前还未排好序的范围内的全部数,</span><br><span class="line"> * 自上而下对相邻的两个数依次进行比较和调整, 让较大的数往下沉,</span><br><span class="line"> * 较小的数往上冒。即: 每当两相邻的数比较后发现它们的排序与排序</span><br><span class="line"> * 要求相反时,就将他们互换.</span><br><span class="line"> */</span><br><span class="line">public static void bubbleSort() &#123;</span><br><span class="line">	// 要排序的数组</span><br><span class="line">	int[] array=&#123;49,38,65,97,76,13,27,49,78,34,12,64,5,4,</span><br><span class="line">			62,99,98,54,56,17,18,23,34,15,35,25,53,51&#125;;</span><br><span class="line">	// 临时变量</span><br><span class="line">	int temp = 0;</span><br><span class="line">	for(int i = 0, size = array.length; i &lt; size; i++)&#123;</span><br><span class="line">		for(int j = 0; j &lt; size - 1; j++)&#123;</span><br><span class="line">			if (array[j] &gt; array[j+1]) &#123;</span><br><span class="line">				temp = array[j];</span><br><span class="line">				array[j] = array[j+1];</span><br><span class="line">				array[j+1] = temp;</span><br><span class="line">			&#125;</span><br><span class="line">		&#125;</span><br><span class="line">	&#125;</span><br><span class="line">	for(int i = 0, size = array.length; i &lt; size; i++)&#123;</span><br><span class="line">		System.out.println(array[i]);</span><br><span class="line">	&#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<ol start="6">
<li>快速排序<br><img src="http://upload-images.jianshu.io/upload_images/3110861-b1a13384fcde1c63.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="快速排序.png"></li>
</ol>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br></pre></td><td class="code"><pre><span class="line">/**</span><br><span class="line"> * 快速排序</span><br><span class="line"> * 思想: 选择一个基准元素,通常选择第一个元素或者最后一个元素,通过</span><br><span class="line"> * 一趟扫描,将待排序列分成两部分,一部分比基准元素小,一部分大于等于</span><br><span class="line"> * 基准元素,此时基准元素在其排好序后的正确位置,然后再用同样的方法递</span><br><span class="line"> * 归的排序划分的两部分. </span><br><span class="line"> */</span><br><span class="line">public static void quickSort() &#123;</span><br><span class="line">	// 要排序的字段</span><br><span class="line">	int[] array=&#123;49,38,65,97,76,13,27,49,78,34,12,64,5,4,62,99,98,</span><br><span class="line">			54,56,17,18,23,34,15,35,25,53,51&#125;;   </span><br><span class="line">	</span><br><span class="line">	quickSort(array, 0, array.length - 1);</span><br><span class="line">	</span><br><span class="line">	// 打印数组[]</span><br><span class="line">	for(int i = 0, size = array.length; i &lt; size; i++)&#123;</span><br><span class="line">		System.out.println(array[i]);</span><br><span class="line">	&#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">/**</span><br><span class="line"> * 快速排序</span><br><span class="line"> * @param array 数组</span><br><span class="line"> * @param start 开始位置</span><br><span class="line"> * @param end 结束位置</span><br><span class="line"> */</span><br><span class="line">private static void quickSort(int[] array, int start, int end) &#123;</span><br><span class="line">	if (start &lt; end) &#123;</span><br><span class="line">		// 将数组进行一分</span><br><span class="line">		int middle = getMiddle(array, start, end);</span><br><span class="line">		// 对低字表进行递归</span><br><span class="line">		quickSort(array, start, middle - 1);</span><br><span class="line">		// 对高字表进行递归</span><br><span class="line">		quickSort(array, middle + 1, end);</span><br><span class="line">	&#125;</span><br><span class="line">	</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">/**</span><br><span class="line"> * 获取中间值</span><br><span class="line"> * @param array 数组</span><br><span class="line"> * @param start 开始位置</span><br><span class="line"> * @param end 结束位置</span><br><span class="line"> * @return 中间值</span><br><span class="line"> */</span><br><span class="line">private static int getMiddle(int[] array, int start, int end) &#123;</span><br><span class="line">	// 将数组的第一个作为中轴</span><br><span class="line">	int tmp = array[start];</span><br><span class="line">	while (start &lt; end) &#123;</span><br><span class="line">		while (start &lt; end &amp;&amp; array[end] &gt;= tmp) &#123;</span><br><span class="line">			end--;				</span><br><span class="line">		&#125;</span><br><span class="line">		// 比中轴小的记录移到低端</span><br><span class="line">		array[start] = array[end];</span><br><span class="line">		while(start &lt; end &amp;&amp; array[start] &lt;= tmp)&#123;</span><br><span class="line">			start++;</span><br><span class="line">		&#125;</span><br><span class="line">		// 比中轴大的记录移到高端</span><br><span class="line">		array[end]=array[start];</span><br><span class="line">	&#125;</span><br><span class="line">	// 中轴记录到尾</span><br><span class="line">	array[start] = tmp;</span><br><span class="line">	// 返回中轴的位置</span><br><span class="line">	return start;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<ol start="7">
<li>归并排序</li>
</ol>
<p><img src="http://upload-images.jianshu.io/upload_images/3110861-cde6636d4ac42f36.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="归并排序.png"></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br></pre></td><td class="code"><pre><span class="line">/**</span><br><span class="line"> * 归并排序</span><br><span class="line"> * 思想: 归并(Merge)排序法是将两个(或两个以上)有序表合并成一个新的有序报表,</span><br><span class="line"> * 即把待排序序列分为若干个子序列, 每个子序列是有序的, 然后再把有序子序列合并</span><br><span class="line"> * 为整体有序序列.</span><br><span class="line"> */</span><br><span class="line">public static void mergingSort() &#123;</span><br><span class="line">	// 要排序的数组</span><br><span class="line">	int[] array=&#123;49,38,65,97,76,13,27,49,78,34,12,64,5,4,62,99,98,</span><br><span class="line">			54,56,17,18,23,34,15,35,25,53,51&#125;;   </span><br><span class="line">	</span><br><span class="line">	// 归并排序</span><br><span class="line">	mergingSort(array, 0, array.length - 1);</span><br><span class="line">	</span><br><span class="line">	for(int i = 0, size = array.length; i &lt; size; i++)&#123;</span><br><span class="line">		System.out.println(array[i]);</span><br><span class="line">	&#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">/**</span><br><span class="line"> * 归并排序</span><br><span class="line"> * @param array 数组</span><br><span class="line"> * @param start 开始位置</span><br><span class="line"> * @param end 结束位置</span><br><span class="line"> */</span><br><span class="line">private static void mergingSort(int[] array, int start, int end) &#123;</span><br><span class="line">	// 判断开始位置是否小于结束位置</span><br><span class="line">	if (start &lt; end) &#123;</span><br><span class="line">		// 找出中间索引</span><br><span class="line">		int center = (start + end) / 2;</span><br><span class="line">		// 对左边数组进行递归</span><br><span class="line">		mergingSort(array, start, center);</span><br><span class="line">		// 对右边数组进行递归</span><br><span class="line">		mergingSort(array, center + 1, end);</span><br><span class="line">		// 合并</span><br><span class="line">		merge(array, start, center, end);</span><br><span class="line">	&#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">/**</span><br><span class="line"> * 合并数据</span><br><span class="line"> * @param array 数组</span><br><span class="line"> * @param start 开始位置</span><br><span class="line"> * @param center 中间位置</span><br><span class="line"> * @param end 结束位置</span><br><span class="line"> */</span><br><span class="line">private static void merge(int[] array, int start, int center, int end) &#123;</span><br><span class="line">	// 创建一个临时数组</span><br><span class="line">	int[] tmpArr = new int[array.length];</span><br><span class="line">	// 中间位置</span><br><span class="line">	int mid = center + 1;</span><br><span class="line">	// third 记录中间数组的索引</span><br><span class="line">	int third = start;</span><br><span class="line">	int tmp = start;</span><br><span class="line">	while(start &lt;= center &amp;&amp; mid &lt;= end)&#123;</span><br><span class="line">		// 从两个数组中取出最小的放入中间数组</span><br><span class="line">		if (array[start] &lt;= array[mid]) &#123;</span><br><span class="line">			tmpArr[third++] = array[start++];</span><br><span class="line">		&#125; else &#123;</span><br><span class="line">			tmpArr[third++] = array[mid++];</span><br><span class="line">		&#125;</span><br><span class="line">	&#125;</span><br><span class="line">	// 剩余部分依次放入中间数组</span><br><span class="line">	while(mid &lt;= end)&#123;</span><br><span class="line">		tmpArr[third++] = array[mid++];</span><br><span class="line">	&#125;</span><br><span class="line">	while (start &lt;= center) &#123;</span><br><span class="line">		tmpArr[third++] = array[start++];			</span><br><span class="line">	&#125;</span><br><span class="line">	// 将中间数组中的内容复制回原数组</span><br><span class="line">	while(tmp &lt;= end)&#123;</span><br><span class="line">		array[tmp] = tmpArr[tmp++];</span><br><span class="line">	&#125;</span><br><span class="line">	System.out.println(Arrays.toString(array));</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<ol start="8">
<li>基数排序</li>
</ol>
<p><img src="http://upload-images.jianshu.io/upload_images/3110861-ce4f481089bacba1.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="基数排序.png"></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br></pre></td><td class="code"><pre><span class="line">/**</span><br><span class="line"> * 基数排序</span><br><span class="line"> * 思想: 将所有待比较数(正整数)统一为同样的数位长度, 数位较短的数</span><br><span class="line"> * 前面补零, 从最低位开始,依次进行依次排序.这样从最低位排序一直到</span><br><span class="line"> * 最高位排序完成以后,数列就变成一个有序序列.</span><br><span class="line"> */</span><br><span class="line">public static void radixSort() &#123;</span><br><span class="line">	// 要排序的数组</span><br><span class="line">	int[] array=&#123;49,38,65,97,76,13,27,49,78,34,12,64,5,4,62,</span><br><span class="line">			99,98,54,101,56,17,18,23,34,15,35,25,53,51&#125;;   </span><br><span class="line">	radixSort(array);</span><br><span class="line">	for(int i = 0, size = array.length; i &lt; size; i++)&#123;</span><br><span class="line">		System.out.println(array[i]);</span><br><span class="line">	&#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">/**</span><br><span class="line"> * 基数排序</span><br><span class="line"> * @param array 数组</span><br><span class="line"> */</span><br><span class="line">private static void radixSort(int[] array) &#123;</span><br><span class="line">	// 首先确定要排序的躺数</span><br><span class="line">	int max = array[0];</span><br><span class="line">	for(int i = 1, size = array.length; i &lt; size;i++)&#123;</span><br><span class="line">		if (array[i] &gt; max) &#123;</span><br><span class="line">			max = array[i];</span><br><span class="line">		&#125;</span><br><span class="line">	&#125;</span><br><span class="line">	int time = 0;</span><br><span class="line">	// 判断位数</span><br><span class="line">	while(max &gt; 0)&#123;</span><br><span class="line">		max /= 10;</span><br><span class="line">		time++;</span><br><span class="line">	&#125;</span><br><span class="line">	</span><br><span class="line">	// 建立10个队列:</span><br><span class="line">	List&lt;ArrayList&gt; queue = new ArrayList&lt;&gt;();</span><br><span class="line">	for(int i = 0; i &lt; 10; i++)&#123;</span><br><span class="line">		ArrayList&lt;Integer&gt; queue1 = new ArrayList&lt;&gt;();</span><br><span class="line">		queue.add(queue1);</span><br><span class="line">	&#125;</span><br><span class="line">	</span><br><span class="line">	// 进行time此分配和收集</span><br><span class="line">	for(int i = 0; i &lt; time; i++)&#123;</span><br><span class="line">		// 分配数组元素</span><br><span class="line">		for(int j = 0, size = array.length; j &lt; size; j++)&#123;</span><br><span class="line">			// 得到数字的第time+1位数</span><br><span class="line">			int x = array[j] % (int)Math.pow(10, i + 1) / (int)Math.pow(10, i);</span><br><span class="line">			</span><br><span class="line">			// 将数据填入相应位置</span><br><span class="line">			ArrayList&lt;Integer&gt; queue2 = queue.get(x);</span><br><span class="line">			queue2.add(array[j]);</span><br><span class="line">			queue.set(x, queue2);</span><br><span class="line">		&#125;</span><br><span class="line">		// 元素计数器</span><br><span class="line">		int count = 0;</span><br><span class="line">		// 收集队列元素</span><br><span class="line">		for(int k = 0; k &lt; 10; k++)&#123;</span><br><span class="line">			while(queue.get(k).size() &gt; 0)&#123;</span><br><span class="line">				ArrayList&lt;Integer&gt; queue3 = queue.get(k);</span><br><span class="line">				array[count] = queue3.get(0);</span><br><span class="line">				queue3.remove(0);</span><br><span class="line">				count++;</span><br><span class="line">			&#125;</span><br><span class="line">		&#125;</span><br><span class="line">	&#125;		</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/blog/2018/08/06/Algorithm/Java-最常用的10大算法/" rel="prev" title="Java-最常用的10大算法">
                Java-最常用的10大算法 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      

      <section class="site-overview-wrap sidebar-panel sidebar-panel-active">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image"
                src="/blog/images/avatar.jpeg"
                alt="凌浩雨" />
            
              <p class="site-author-name" itemprop="name">凌浩雨</p>
              <p class="site-description motion-element" itemprop="description">专业从事于移动端开发，Android与iOS均有涉及，主做Android开发与React Native开发</p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/blog/archives/">
              
                  <span class="site-state-item-count">393</span>
                  <span class="site-state-item-name">posts</span>
                </a>
              </div>
            

            

            

          </nav>

          

          

          
          

          
          

          

        </div>
      </section>

      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2018</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">凌浩雨</span>

  
</div>


  <div class="powered-by">Powered by <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a></div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">Theme &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Pisces</a> v5.1.4</div>




        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/blog/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/blog/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/blog/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/blog/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/blog/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/blog/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/blog/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/blog/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  





  

  

  

  
  

  

  

  

</body>
</html>
